package com.kingbull.webservice;

import javax.jws.WebService;

import com.kingbull.web.communic.Subject;
import com.kingbull.web.mapper.Mapper;
import com.kingbull.webservice.shunt.Entrance;
import net.sf.json.JSONObject;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

/**
 * 接口实现
 * 
 * @author refineli
 *
 */
@WebService(serviceName = "CommonService", // 与接口中指定的name一致
		targetNamespace = "http://webservice.kingbull.com/", // 与接口中的命名空间一致,一般是接口的包名倒
		endpointInterface = "com.kingbull.webservice.CommonService"// 接口地址
)
@Component
public class CommonServiceImp implements CommonService {
	@Autowired
	private Mapper mapper;

	@Autowired
	private Entrance entrance;

	@Override
	public String sayHello(String name) {
		return "Hello ," + name;
	}

	@Override
	public String Entrance(String obj) {
		System.out.println("接收结果:" + obj);
		mapper.saveLog(obj,"0");
		JSONObject jsonobject = JSONObject.fromObject(obj);
		Subject sob = (Subject) JSONObject.toBean(jsonobject,Subject.class);
		return entrance.Main(sob);
	}

	@Override
	public String IDCard(String obj) {
		System.out.println("接收结果:" + obj);
		mapper.saveLog(obj,"0");
		JSONObject jsonobject = JSONObject.fromObject(obj);
		Subject sob = (Subject) JSONObject.toBean(jsonobject,Subject.class);
		return entrance.IdCard(sob);
	}

}
